/** @param {NS} ns */
export async function root_a_server(ns,server_name) {
  let strServerName = server_name;
  let portOpen = 0;
    let hasNuke = false;
    if(ns.fileExists("BruteSSH.exe","home"))
    {
      ns.brutessh(strServerName);      
      ++portOpen;
    }
    if(ns.fileExists("FTPCrack.exe","home"))
    {
      ns.ftpcrack(strServerName); 
      ++portOpen;
    }
    if(ns.fileExists("relaySMTP.exe","home"))
    {
      ns.relaysmtp(strServerName); 
      ++portOpen;
    }
    //HTTPWorm.exe
    if(ns.fileExists("HTTPWorm.exe","home"))
    {
      ns.httpworm(strServerName); 
      ++portOpen;
    }
    //SQLInject.exe
    if(ns.fileExists("SQLInject.exe","home"))
    {
      ns.sqlinject(strServerName); 
      ++portOpen;
    }

    let portsRequire = ns.getServerNumPortsRequired(strServerName);
    if(portsRequire<=portOpen)
    {
      ns.nuke(strServerName);
      // ns.tprint("执行nuke在",strServerName);
      hasNuke = true;
    }

}